package com.cdc.shapeofview;
import androidx.appcompat.app.AppCompatActivity;

import android.animation.ValueAnimator;
import android.os.Bundle;

import com.github.florent37.shapeofview.shapes.RoundRectView;
public class ShapeOfViewAnimationActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.shape_of_view_activity_anim);
        final RoundRectView roundRectView=findViewById(R.id.roundRect);
        if (roundRectView != null) {

            ValueAnimator valueAnimator= ValueAnimator.ofFloat(0f, 200f, 0f).setDuration(800);
            valueAnimator.setRepeatMode(ValueAnimator.REVERSE);
            valueAnimator.setRepeatCount(ValueAnimator.INFINITE);
            valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                    roundRectView.setBottomLeftRadius((Float) valueAnimator.getAnimatedValue());
                }});
            valueAnimator.start();
        }

    }
}
